<template>
	<view>
		<u-button text="确定支付" @click="readypay"></u-button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				payid:0,
			}
		},
		methods: {
			readypay(id){
				this.$post(this.API.pay,{orderId:this.payid}).then(res=>{
					if(res.data.errno==0){
						uni.showToast({
							title: res.data.errmsg,
							icon: 'success',
							duration: 2000
						});
						setTimeout(()=>{
							uni.reLaunch({
								url:'/pages/orderlist/orderlist'
							})
						},2000)
					}else{
						uni.showToast({
							title: res.data.errmsg,
							icon: 'error',
							duration: 2000
						});
						
					}
				})
			}
		},
		onLoad(options) {
			console.log(options.id)
			this.payid=options.id
			
		}
	}
</script>

<style>

</style>
